package com.xigua.volatileDemo;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2021/12/2512:00
 */
public class VolatileAtomicThread extends Thread {

//    private volatile int count = 0;
        private AtomicInteger atomicInteger = new AtomicInteger(0);

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {

            int i1 = atomicInteger.incrementAndGet();
            System.out.println("i1====================>"+i1);
//                synchronized ("o") {
//                    ++count;
//                    System.out.println("count===========>" + count);
//                }
        }
    }
}
